package com.tsugun.mediaplayer.view.adapter;

import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.tsugun.mediaplayer.view.fragment.subfragment.SubBaseFragment;

import java.util.List;

/**
 * viewpager适配器
 * Created by shize on 2017/4/7.
 */

public class ViewPagerAdapter extends FragmentPagerAdapter {

    private List<SubBaseFragment> mFragments;
    private List<String> mTitles;

    public ViewPagerAdapter(FragmentManager fm, List<SubBaseFragment> fragments, List<String> titles) {
        super(fm);
        mFragments = fragments;
        mTitles = titles;
    }

    @Override
    public SubBaseFragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mTitles.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles.get(position);
    }
}
